<style scoped src="./index.scss" lang="scss" rel="stylesheet/scss"></style>
<template src="./index.html"></template>
<script>
import Details from "./../details/index";
import Reject from "./../reject/index";
import Payment from "./../payment/index";
import Collection from "./../collection/index";
export default {
  mixins: [
    Vue.prototype.$vFN.Mixins.Base,
    Vue.prototype.$vFN.Mixins.Page,
    Vue.prototype.$vFN.Mixins.Table,
  ],
  data() {
    return {
      appWindow: window,
      // 页面接口地址
      apiUrl: {
        list: "admin/withdraw/index?pageNum=1&pageSize=20",
        // delete: "store/withdraw/del",
      },
      // 表格查询数据
      mixinTable_tableSearchData: {},

      // 表格数据删除展示结构
      tableDeleteConfig: {
        columns: [
          {
            label: "图标",
            prop: "icon",
            type: "img",
          },
          {
            label: "分组名称",
            prop: "name",
          },
        ],
      },
      // 表格数据类型
      mixinTable_tableDataType: "tree",
    };
  },
  methods: {
    // 打款
    async payment(_id) {
      Payment.init({
        id: _id,
      })
    },
    // 收款
    async collection(_id) {
      Collection.init({
        id: _id,
      })
    },
    details(params_) {
      Details.init({
        mixinEdit_parent: this,
        mixinEdit_editType: params_.type,
        id: params_.id,
        data: params_.data,
        onSuccess: (res) => {
          this.mixinTable_refreshData();
        },
      });
    },
    reject(params_) {
      Reject.init({
        mixinEdit_parent: this,
        mixinEdit_editType: params_.type,
        id: params_.id,
        data: params_.data,
        onSuccess: (res) => {
          this.mixinTable_refreshData();
        },
      });
    },
    // 审核通过
    async pass(params_) {
      console.log(params_);
      this.$confirm("确定进行此操作吗？", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        // type: "error",
        dangerouslyUseHTMLString: true,
      })
        .then(async () => {
          let res = await this.$vFN.Http.post(
            {
              url: "admin/withdraw/pass",
              data: {
                id: params_.id,
              },
            },
            window
          );
          this.mixinTable_refreshData();
          if (res.success) {
            this.$vFN.Tools.messageSuccess("操作成功");
            this.editBoxClose();
            this.onSuccess();
          }
        })
        .catch(() => {});
    },
    // 初始化
    async init() {
      this.mixinTable_refreshData();
    },
  },
  mounted() {
    this.init();
  },
  activated() {},
};
</script>